.class public Lmyclass/HttpConn;
.super Ljava/lang/Object;
.source "HttpConn.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lmyclass/HttpConn$GetImage;
    }
.end annotation


# static fields
.field private static TIMEOUT_TIME:I


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 31
    const v0, 0x9c40

    sput v0, Lmyclass/HttpConn;->TIMEOUT_TIME:I

    return-void
.end method

.method public constructor <init>()V
    .locals 0

    .prologue
    .line 30
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method public static drawimg(Ljava/lang/String;)Landroid/graphics/Bitmap;
    .locals 8
    .param p0, "Str_url"    # Ljava/lang/String;

    .prologue
    .line 161
    new-instance v3, Lorg/apache/http/client/methods/HttpGet;

    invoke-direct {v3, p0}, Lorg/apache/http/client/methods/HttpGet;-><init>(Ljava/lang/String;)V

    .line 162
    .local v3, "httpRequest":Lorg/apache/http/client/methods/HttpGet;
    new-instance v4, Lorg/apache/http/impl/client/DefaultHttpClient;

    invoke-direct {v4}, Lorg/apache/http/impl/client/DefaultHttpClient;-><init>()V

    .line 165
    .local v4, "httpclient":Lorg/apache/http/client/HttpClient;
    :try_start_0
    invoke-interface {v4, v3}, Lorg/apache/http/client/HttpClient;->execute(Lorg/apache/http/client/methods/HttpUriRequest;)Lorg/apache/http/HttpResponse;

    move-result-object v6

    .line 166
    .local v6, "response":Lorg/apache/http/HttpResponse;
    invoke-interface {v6}, Lorg/apache/http/HttpResponse;->getEntity()Lorg/apache/http/HttpEntity;

    move-result-object v2

    .line 168
    .local v2, "entity":Lorg/apache/http/HttpEntity;
    new-instance v0, Lorg/apache/http/entity/BufferedHttpEntity;

    invoke-direct {v0, v2}, Lorg/apache/http/entity/BufferedHttpEntity;-><init>(Lorg/apache/http/HttpEntity;)V

    .line 169
    .local v0, "bufferedHttpEntity":Lorg/apache/http/entity/BufferedHttpEntity;
    invoke-virtual {v0}, Lorg/apache/http/entity/BufferedHttpEntity;->getContent()Ljava/io/InputStream;

    move-result-object v5

    .line 170
    .local v5, "is":Ljava/io/InputStream;
    invoke-static {v5}, Landroid/graphics/BitmapFactory;->decodeStream(Ljava/io/InputStream;)Landroid/graphics/Bitmap;
    :try_end_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v7

    .line 175
    .end local v0    # "bufferedHttpEntity":Lorg/apache/http/entity/BufferedHttpEntity;
    .end local v2    # "entity":Lorg/apache/http/HttpEntity;
    .end local v5    # "is":Ljava/io/InputStream;
    .end local v6    # "response":Lorg/apache/http/HttpResponse;
    :goto_0
    return-object v7

    .line 171
    :catch_0
    move-exception v1

    .line 173
    .local v1, "e":Ljava/io/IOException;
    invoke-virtual {v1}, Ljava/io/IOException;->printStackTrace()V

    .line 175
    const/4 v7, 0x0

    goto :goto_0
.end method

.method public static drawimg(Ljava/lang/String;Ljava/lang/String;)Landroid/graphics/drawable/Drawable;
    .locals 8
    .param p0, "Str_url"    # Ljava/lang/String;
    .param p1, "imgaddress"    # Ljava/lang/String;

    .prologue
    .line 180
    const/4 v1, 0x0

    .line 190
    .local v1, "drawimgs":Landroid/graphics/drawable/Drawable;
    :try_start_0
    new-instance v5, Lorg/apache/http/client/methods/HttpGet;

    invoke-direct {v5, p0}, Lorg/apache/http/client/methods/HttpGet;-><init>(Ljava/lang/String;)V

    .line 191
    .local v5, "httpGet":Lorg/apache/http/client/methods/HttpGet;
    invoke-static {}, Lmyclass/HttpConn;->getHttpClient()Lorg/apache/http/client/HttpClient;

    move-result-object v4

    .line 192
    .local v4, "httpClient":Lorg/apache/http/client/HttpClient;
    invoke-interface {v4, v5}, Lorg/apache/http/client/HttpClient;->execute(Lorg/apache/http/client/methods/HttpUriRequest;)Lorg/apache/http/HttpResponse;

    move-result-object v7

    .line 194
    .local v7, "response":Lorg/apache/http/HttpResponse;
    invoke-interface {v7}, Lorg/apache/http/HttpResponse;->getEntity()Lorg/apache/http/HttpEntity;

    move-result-object v3

    .line 195
    .local v3, "entity":Lorg/apache/http/HttpEntity;
    new-instance v0, Lorg/apache/http/entity/BufferedHttpEntity;

    invoke-direct {v0, v3}, Lorg/apache/http/entity/BufferedHttpEntity;-><init>(Lorg/apache/http/HttpEntity;)V

    .line 196
    .local v0, "bufferEntity":Lorg/apache/http/entity/BufferedHttpEntity;
    invoke-virtual {v0}, Lorg/apache/http/entity/BufferedHttpEntity;->getContent()Ljava/io/InputStream;

    move-result-object v6

    .line 198
    .local v6, "is":Ljava/io/InputStream;
    invoke-virtual {v6}, Ljava/io/InputStream;->close()V

    .line 199
    invoke-static {v6, p1}, Landroid/graphics/drawable/Drawable;->createFromStream(Ljava/io/InputStream;Ljava/lang/String;)Landroid/graphics/drawable/Drawable;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v1

    .line 204
    .end local v0    # "bufferEntity":Lorg/apache/http/entity/BufferedHttpEntity;
    .end local v1    # "drawimgs":Landroid/graphics/drawable/Drawable;
    .end local v3    # "entity":Lorg/apache/http/HttpEntity;
    .end local v4    # "httpClient":Lorg/apache/http/client/HttpClient;
    .end local v5    # "httpGet":Lorg/apache/http/client/methods/HttpGet;
    .end local v6    # "is":Ljava/io/InputStream;
    .end local v7    # "response":Lorg/apache/http/HttpResponse;
    :goto_0
    return-object v1

    .line 201
    .restart local v1    # "drawimgs":Landroid/graphics/drawable/Drawable;
    :catch_0
    move-exception v2

    .line 202
    .local v2, "e":Ljava/lang/Exception;
    invoke-virtual {v2}, Ljava/lang/Exception;->printStackTrace()V

    .line 204
    const/4 v1, 0x0

    goto :goto_0
.end method

.method private static getHttpClient()Lorg/apache/http/client/HttpClient;
    .locals 4

    .prologue
    .line 147
    new-instance v1, Lorg/apache/http/params/BasicHttpParams;

    invoke-direct {v1}, Lorg/apache/http/params/BasicHttpParams;-><init>()V

    .line 148
    .local v1, "httpParams":Lorg/apache/http/params/HttpParams;
    sget v3, Lmyclass/HttpConn;->TIMEOUT_TIME:I

    invoke-static {v1, v3}, Lorg/apache/http/params/HttpConnectionParams;->setConnectionTimeout(Lorg/apache/http/params/HttpParams;I)V

    .line 149
    sget v3, Lmyclass/HttpConn;->TIMEOUT_TIME:I

    invoke-static {v1, v3}, Lorg/apache/http/params/HttpConnectionParams;->setSoTimeout(Lorg/apache/http/params/HttpParams;I)V

    .line 150
    const v3, 0x14000

    invoke-static {v1, v3}, Lorg/apache/http/params/HttpConnectionParams;->setSocketBufferSize(Lorg/apache/http/params/HttpParams;I)V

    .line 151
    const/4 v3, 0x1

    invoke-static {v1, v3}, Lorg/apache/http/client/params/HttpClientParams;->setRedirecting(Lorg/apache/http/params/HttpParams;Z)V

    .line 152
    const-string v2, "android"

    .line 153
    .local v2, "userAgent":Ljava/lang/String;
    invoke-static {v1, v2}, Lorg/apache/http/params/HttpProtocolParams;->setUserAgent(Lorg/apache/http/params/HttpParams;Ljava/lang/String;)V

    .line 155
    new-instance v0, Lorg/apache/http/impl/client/DefaultHttpClient;

    invoke-direct {v0, v1}, Lorg/apache/http/impl/client/DefaultHttpClient;-><init>(Lorg/apache/http/params/HttpParams;)V

    .line 156
    .local v0, "httpClient":Lorg/apache/http/client/HttpClient;
    return-object v0
.end method

.method public static getStr(Ljava/lang/String;)Ljava/lang/String;
    .locals 8
    .param p0, "url"    # Ljava/lang/String;

    .prologue
    .line 35
    const/4 v3, 0x0

    .line 37
    .local v3, "httpGet":Lorg/apache/http/client/methods/HttpGet;
    :try_start_0
    new-instance v4, Lorg/apache/http/client/methods/HttpGet;

    new-instance v6, Ljava/net/URL;

    invoke-direct {v6, p0}, Ljava/net/URL;-><init>(Ljava/lang/String;)V

    invoke-virtual {v6}, Ljava/net/URL;->toString()Ljava/lang/String;

    move-result-object v6

    invoke-direct {v4, v6}, Lorg/apache/http/client/methods/HttpGet;-><init>(Ljava/lang/String;)V
    :try_end_0
    .catch Ljava/net/MalformedURLException; {:try_start_0 .. :try_end_0} :catch_0

    .end local v3    # "httpGet":Lorg/apache/http/client/methods/HttpGet;
    .local v4, "httpGet":Lorg/apache/http/client/methods/HttpGet;
    move-object v3, v4

    .line 42
    .end local v4    # "httpGet":Lorg/apache/http/client/methods/HttpGet;
    .restart local v3    # "httpGet":Lorg/apache/http/client/methods/HttpGet;
    :goto_0
    invoke-static {}, Lmyclass/HttpConn;->getHttpClient()Lorg/apache/http/client/HttpClient;

    move-result-object v2

    .line 44
    .local v2, "httpClient":Lorg/apache/http/client/HttpClient;
    :try_start_1
    invoke-interface {v2, v3}, Lorg/apache/http/client/HttpClient;->execute(Lorg/apache/http/client/methods/HttpUriRequest;)Lorg/apache/http/HttpResponse;

    move-result-object v5

    .line 45
    .local v5, "response":Lorg/apache/http/HttpResponse;
    invoke-interface {v5}, Lorg/apache/http/HttpResponse;->getStatusLine()Lorg/apache/http/StatusLine;

    move-result-object v6

    invoke-interface {v6}, Lorg/apache/http/StatusLine;->getStatusCode()I
    :try_end_1
    .catch Lorg/apache/http/client/ClientProtocolException; {:try_start_1 .. :try_end_1} :catch_1
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_2

    move-result v6

    const/16 v7, 0xc8

    if-eq v6, v7, :cond_0

    .line 46
    const-string v6, "<>200"

    .line 52
    .end local v5    # "response":Lorg/apache/http/HttpResponse;
    :goto_1
    return-object v6

    .line 38
    .end local v2    # "httpClient":Lorg/apache/http/client/HttpClient;
    :catch_0
    move-exception v1

    .line 40
    .local v1, "e1":Ljava/net/MalformedURLException;
    invoke-virtual {v1}, Ljava/net/MalformedURLException;->printStackTrace()V

    goto :goto_0

    .line 47
    .end local v1    # "e1":Ljava/net/MalformedURLException;
    .restart local v2    # "httpClient":Lorg/apache/http/client/HttpClient;
    .restart local v5    # "response":Lorg/apache/http/HttpResponse;
    :cond_0
    :try_start_2
    invoke-interface {v5}, Lorg/apache/http/HttpResponse;->getEntity()Lorg/apache/http/HttpEntity;

    move-result-object v6

    invoke-static {v6}, Lorg/apache/http/util/EntityUtils;->toString(Lorg/apache/http/HttpEntity;)Ljava/lang/String;
    :try_end_2
    .catch Lorg/apache/http/client/ClientProtocolException; {:try_start_2 .. :try_end_2} :catch_1
    .catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_2

    move-result-object v6

    goto :goto_1

    .line 48
    .end local v5    # "response":Lorg/apache/http/HttpResponse;
    :catch_1
    move-exception v0

    .line 49
    .local v0, "e":Lorg/apache/http/client/ClientProtocolException;
    invoke-virtual {v0}, Lorg/apache/http/client/ClientProtocolException;->toString()Ljava/lang/String;

    move-result-object v6

    goto :goto_1

    .line 51
    .end local v0    # "e":Lorg/apache/http/client/ClientProtocolException;
    :catch_2
    move-exception v0

    .line 52
    .local v0, "e":Ljava/io/IOException;
    invoke-virtual {v0}, Ljava/io/IOException;->toString()Ljava/lang/String;

    move-result-object v6

    goto :goto_1
.end method

.method public static loadBitmapImage(Ljava/lang/String;Lmyclass/HttpConn$GetImage;)V
    .locals 2
    .param p0, "strurl"    # Ljava/lang/String;
    .param p1, "getImage"    # Lmyclass/HttpConn$GetImage;

    .prologue
    .line 94
    new-instance v0, Lmyclass/HttpConn$3;

    invoke-direct {v0, p1}, Lmyclass/HttpConn$3;-><init>(Lmyclass/HttpConn$GetImage;)V

    .line 107
    .local v0, "handler":Landroid/os/Handler;
    new-instance v1, Lmyclass/HttpConn$4;

    invoke-direct {v1, p0, v0}, Lmyclass/HttpConn$4;-><init>(Ljava/lang/String;Landroid/os/Handler;)V

    .line 126
    invoke-virtual {v1}, Lmyclass/HttpConn$4;->start()V

    .line 144
    return-void
.end method

.method public static loadDrawImage(Ljava/lang/String;Ljava/lang/String;Lmyclass/HttpConn$GetImage;)V
    .locals 2
    .param p0, "strurl"    # Ljava/lang/String;
    .param p1, "imgaddress"    # Ljava/lang/String;
    .param p2, "getImage"    # Lmyclass/HttpConn$GetImage;

    .prologue
    .line 66
    new-instance v0, Lmyclass/HttpConn$1;

    invoke-direct {v0, p2}, Lmyclass/HttpConn$1;-><init>(Lmyclass/HttpConn$GetImage;)V

    .line 77
    .local v0, "handler":Landroid/os/Handler;
    new-instance v1, Lmyclass/HttpConn$2;

    invoke-direct {v1, p0, p1, v0}, Lmyclass/HttpConn$2;-><init>(Ljava/lang/String;Ljava/lang/String;Landroid/os/Handler;)V

    .line 87
    invoke-virtual {v1}, Lmyclass/HttpConn$2;->start()V

    .line 88
    return-void
.end method
